/*
 * Copyright 2008 p.langer
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * 
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * 	http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package at.ac.tuwien.big.easyholdem.game;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

/**
 * <p>
 * The last state of the game. This is where the game is over.
 * </p>
 * 
 * <p>
 * Created on 16.01.2008 at 23:21:46.
 * </p>
 * 
 * @author Philip Langer <langer[at]big[dot]tuwien[dot]ac[dot]at>
 */
public class EndGameState extends GameState {

	private Collection<Action> possibleActions = new ArrayList<Action>();

	protected EndGameState(Game game) {
		super(game);
		game.createShowdownResult();
		game.payPot();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see at.ac.tuwien.big.easyholdem.game.GameState#act(at.ac.tuwien.big.easyholdem.game.Action)
	 */
	@Override
	protected void act(Action actionToAct) {
		throw new IllegalArgumentException("Cannot act " + actionToAct
				+ " in state " + this.getState());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see at.ac.tuwien.big.easyholdem.game.GameState#getPossibleActions()
	 */
	@Override
	protected Collection<Action> getPossibleActions() {
		return Collections.unmodifiableCollection(this.possibleActions);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see at.ac.tuwien.big.easyholdem.game.GameState#getState()
	 */
	@Override
	protected State getState() {
		return State.END;
	}

}
